﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RelationExpertSystem.Relation
{
    public class Granddaughter : RelationBase
    {
        private static Granddaughter _singleton = new Granddaughter();
        public static Granddaughter Instance
        {
            get { return _singleton; }
        }

        private Granddaughter() { }

        public override bool IsRelated(Person a, Person b)
        {
            // b is a's Granddaughter IFF b is female AND b is a's grandchild
            return b.Sex == Sex.Female && a.KnownRelation(Grandchild.Instance, b);
        }

        public override IEnumerable<IRelation> GetDependencies()
        {
            return new HashSet<IRelation>(new IRelation[] { Grandchild.Instance });
        }
    }
}
